<?php

ini_set('display_errors','1');
ini_set('display_startup_errors','1');
error_reporting (E_ALL);
//ob_start();

$file = base_url() . 'xml/export.xml';
//var_dump($file);
$xmlstr = file_get_contents($file);
//var_dump($xmlstr);


// Load the XML string into a DOMDocument
$xml = new DOMDocument;
$xml->loadXML($xmlstr);

// Make a DOMDocument for the XSL stylesheet
$xsl = new DOMDocument;

// See which user agent is connecting
$UA = getenv('HTTP_USER_AGENT');
/*if (ereg("Symbian", $UA) | ereg("Opera", $UA) | ereg("Motorola", $UA) | ereg("Nokia", $UA) | ereg("Siemens", $UA) | ereg("Samsung", $UA) | ereg("Ericsson", $UA) | ereg("LG", $UA) | ereg("NEC", $UA) |ereg("SEC", $UA) |ereg("MIDP", $UA) | ereg("Windows CE", $UA)) 
  {
    // if a mobile phone, use a wml stylesheet and set appropriate MIME type
    header("Content-type:text/vnd.wap.wml");
    $xsl->load('index-wml.xsl');
  } 
  else */
  {
    // if not a mobile phone, use a html stylesheet
    header("Content-type:text/html");
    $xsl->load('xml/entry_xslt.xsl');
  }

// Make the transformation and print the result
$proc = new XSLTProcessor;

//$proc = xslt_create();
$proc->importStyleSheet($xsl); // attach the xsl rules
echo utf8_decode($proc->transformToXML($xml));